package top.zhangjianyong.entity;

import cn.hutool.crypto.digest.MD5;
import lombok.Data;

import java.nio.charset.Charset;
import java.time.LocalDateTime;
import java.util.Map;

/**
 * @author ： zhangjianyong
 * @date ： 2023/3/27 4:49 PM
 */
@Data
public class ReptileUrl {

    private Long id;

    private String fromUrl;
    private String url;
    private String remark;
    private Integer state;

    private LocalDateTime createTime;
    private LocalDateTime updateTime;

    public ReptileUrl() {
    }

    public ReptileUrl(Map<String, Object> map) {
        this.id = (Long) map.getOrDefault("ID", null);
        this.url = (String) map.getOrDefault("URL", null);
        this.fromUrl = (String) map.getOrDefault("FROM_URL", null);
        this.state = (Integer) map.getOrDefault("STATE", null);
        this.remark = (String) map.getOrDefault("REMARK", null);
        this.createTime = (LocalDateTime) map.getOrDefault("CREATE_TIME", null);
        this.updateTime = (LocalDateTime) map.getOrDefault("UPDATE_TIME", null);
    }

    public static void main(String[] args) {
        String s = MD5.create().digestHex("http://www.baidu.com", Charset.forName("UTF-8"));
        System.out.println(s);
    }
}
